package io.polly.ldz.reactor.mvc;

import co.elastic.clients.elasticsearch.ElasticsearchClient;
import co.elastic.clients.elasticsearch._types.query_dsl.MatchQuery;
import co.elastic.clients.elasticsearch._types.query_dsl.QueryBuilders;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author ldz112@163.com
 * @Classname MatchController
 * @Version V1.0
 * @Description TODO
 * @Date 2024/10/9 18:24
 * Copyright (C) 2023 All Rights Reserved
 */
@RestController
@Slf4j
public class MatchController {


    final static String INDEX_NAME = "question";

    @Autowired
    private ElasticsearchClient elasticsearchClient;


    @RequestMapping("/match1")
    public List<Question> match1() {
        List<Question> questions = new ArrayList<>();
        MatchQuery matchQuery = QueryBuilders.match().field("content").field("title").query("内容").build();

        return questions;
    }
}
